/**   
 * 项目名：化工企业安全生产信息化管理平台
 * 日期：    2020-07-26 23:10:28  
 * Copyright (c) 2015- -版权所有     
 */

package com.joysuch.wwyt.bp.entity;

import com.joysuch.wwyt.core.support.AutoSetCommonFieldListener;
import lombok.Data;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.hibernate.annotations.SQLDelete;
import org.hibernate.annotations.SQLDeleteAll;
import org.hibernate.annotations.Where;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import javax.persistence.*;

import static javax.persistence.GenerationType.IDENTITY;

@EntityListeners({ AuditingEntityListener.class, AutoSetCommonFieldListener.class })
@Entity
@Table(name = "wwyt_bp_device_facility_stop_recover_record")
@SQLDelete(sql="update wwyt_bp_device_facility_stop_recover_record set DELETE_FLAG = '1' where id= ?")
@SQLDeleteAll(sql="update wwyt_bp_device_facility_stop_recover_record set DELETE_FLAG = '1' where id= ?")
@Where(clause="DELETE_FLAG = '0'")
@Data
public class BpDeviceFacilityStopRecoverRecord implements java.io.Serializable{
    
    //columns START
     @Id
    @GeneratedValue(strategy = IDENTITY)
    
    //ID
    @Column(name = "ID", unique = true, nullable = false)
    private Long id;
    
    //租户
    @Column(name = "TENENT_ID")
    private Long tenentId;
    
    //组织机构代码
    @Column(name = "ORG_CODE", length = 64)
    private String orgCode;
    
    //日期（实际恢复日期/实际停用日期）
    @Column(name = "STOP_OR_RECOVER_ACTUAL_DATE")
    private java.util.Date stopOrRecoverActualDate;
    
    //类型(S表示停用,R表示恢复)
    @Column(name = "TYPE", length = 1)
    private String type;
    
    //登记人
    @Column(name = "REGISTER_USER_ID")
    private Long registerUserId;
    
    //停用理由
    @Column(name = "STOP_REASON", length = 500)
    private String stopReason;
    
    //停用后措施
    @Column(name = "MEASURES_AFTER_STOP", length = 500)
    private String measuresAfterStop;
    
    //登记时间
    @Column(name = "REGISTER_TIME")
    private java.util.Date registerTime;
    
    //附件
    @Column(name = "ATTACHMENT_ID")
    private Long attachmentId;
    
    //创建人
    @org.springframework.data.annotation.CreatedBy
    @Column(name = "CREATE_BY")
    private Long createBy;
    
    //创建时间
    @org.springframework.data.annotation.CreatedDate
    @Column(name = "CREATE_TIME")
    private java.util.Date createTime;
    
    //更新人
    @org.springframework.data.annotation.LastModifiedBy
    @Column(name = "UPDATE_BY")
    private Long updateBy;
    
    //更新时间
    @org.springframework.data.annotation.LastModifiedDate
    @Column(name = "UPDATE_TIME")
    private java.util.Date updateTime;
    
    //删除标记
    @Column(name = "DELETE_FLAG", length = 2)
    private String deleteFlag;
    
    //设备装置ID(wwyt_bp_production_facility表)
    @Column(name = "DEVICE_FACILITY_ID")
    private Long deviceFacilityId;
    //columns END

    //恢复理由
    private String recoverReason;

    public int hashCode() {
        return new HashCodeBuilder()
            .append(getId())
            .toHashCode();
    }
    
    public boolean equals(Object obj) {
        if(obj instanceof BpDeviceFacilityStopRecoverRecord == false) return false;
        if(this == obj) return true;
        BpDeviceFacilityStopRecoverRecord other = (BpDeviceFacilityStopRecoverRecord)obj;
        return new EqualsBuilder()
            .append(getId(),other.getId())
            .isEquals();
    }
}

